package com.wx.chapter8.homework13;

/**
 * ClassName:Person
 * Package :com.wx.chapter8.homework13
 * Description :
 *
 * @Author : coder_mu
 * @Create : 2023/5/29 - 20:18
 */
//父类
public class Person {
    private String name;
    private char gender;
    private int age;

    public String play() {//玩耍方法
        return "玩耍";
    }

    //打印信息方法
    public void printInfo() {//打印详细信息方法
        System.out.println(name + "的信息:");
        System.out.println("姓名:" + name);
        System.out.println("年龄:" + age);
        System.out.println("性别:" + gender);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public char getGender() {
        return gender;
    }

    public void setGender(char gender) {
        this.gender = gender;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Person(String name, char gender, int age) {
        this.name = name;
        this.gender = gender;
        this.age = age;
    }

    @Override
    public String toString() {//重写toString()方法
        return "Person{" +
                "name='" + name + '\'' +
                ", gender=" + gender +
                ", age=" + age +
                '}';
    }

}
